package com.hystrix.config;

import com.common.pojo.Dept;
import com.hystrix.service.DeptHystrixService;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author Str
 * @Date 2022/1/18 15:08
 * @Description :服务出错后调用
 */
@Component
@RequestMapping("/deptFallback")  // 注意，一定不要让映射地址重复
public class DeptHystrixServiceFallback implements DeptHystrixService {

    @Override
    public Dept getDeptById(Integer id) {
        System.out.println("调用消息接口失败，对其进行降级处理！");
        return null;
    }

    @Override
    public String getLongTime() {
        return "消息接口繁忙，请稍后重试！";
    }

    @Override
    public String getShortTime() {
        return "消息接口繁忙，请稍后重试！";
    }

    @Override
    public String divide(Integer num) {
        return "数据错误，请重新输入！";
    }
}